package com.git.hui.yinshua.api.model.order;

import lombok.Getter;

/**
 * 支付方式
 *
 * @author YiHui
 * @date 2024/6/20
 */
@Getter
public enum PayTypeEnum {
    WEIXIN(10, "微信"),
    // 用于前端告诉后端已经支付成功了，但是后台还没有收到微信回调的场景
    ZHIFUBAO(20, "支付宝"),
    YINGHANG(30, "银行卡"),
    OTHER(100, "其他"),
    ;

    private Integer type;
    private String desc;

    PayTypeEnum(Integer status, String desc) {
        this.type = status;
        this.desc = desc;
    }

    public static PayTypeEnum typeOf(int type) {
        for (PayTypeEnum p : values()) {
            if (p.getType() == type) {
                return p;
            }
        }
        return OTHER;
    }
}
